#user  nobody;
worker_processes  auto;
worker_rlimit_nofile 65536;

events {
    use epoll;
    worker_connections  65536;
}
### TCP代理
stream {

    log_format proxy '$remote_addr [$time_local] '
               '$protocol $status $bytes_sent $bytes_received '
               '$session_time "$upstream_addr" '
               '"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';
    access_log logs/kube_api.log proxy;

    upstream kubeapi {
        hash $remote_addr consistent;
        server {{nginx1}}:6443 max_fails=3 fail_timeout=30s;
        server {{nginx2}}:6443 max_fails=3 fail_timeout=30s;
        server {{nginx3}}:6443 max_fails=3 fail_timeout=30s;
    }
    server {
        listen 8443;
        proxy_connect_timeout 10s;
        proxy_timeout 3h;
        proxy_pass kubeapi;
    }
}
# --------------------------------------
http {
    include       mime.types;
    default_type  application/octet-stream;

	log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                    '$status $body_bytes_sent "$http_referer" '
                    '"$http_user_agent" "$http_x_forwarded_for"'
                    '$upstream_addr $upstream_response_time $request_time ';

    access_log  logs/access.log  main;

    sendfile      on;
    server_tokens off;
    keepalive_timeout  65;
# --------------------------------------
    gzip  on;
    gzip_min_length 1k;
    gzip_comp_level 6;
    gzip_vary on;
    gzip_proxied any;
    gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css application/json;
# ------------------------------------
    upstream traefik_web {
        keepalive 1800;
        server 10.10.10.10;
    }
    server {
        listen 8888;
        location / {
          proxy_http_version 1.1;
          proxy_set_header Host myapp.nginx.com;
          proxy_pass http://traefik_web;  
        }
       location /status {
         check_status;
         access_log   off;
         #allow 192.168.10.0/24;
         #deny all;
       }
    }
}
